# -*- coding:utf-8 -*-

import json
from copy import deepcopy

class JsonLoader(object):
    def __init__(self):
        pass

    
    def loadFirstImage(self, jsonFileName, pid):
        try:
            with open(jsonFileName) as in_file:
                info = json.load(in_file)
        except Exception as e:
            print("error, open json file {} failed, {}".format(jsonFileName, e))
            raise e
        
        edges = info['edges'][pid]
        nodes = info['nodes'][pid]
        network = {'edges':edges, 'nodes':nodes}
        return network
